UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'asuGD5FbnVPDfj4tUs1muNRCGkwrG3cFEK3okK4te2A=' 
WHERE 
  key_id = 'd5f10184edfa0a3e7755bbe600f8015301993ae79d51887d0b66fac3f70f1043' 
  AND (
    token = 'asuGD5FbnVPDfj4tUs1muNRCGkwrG3cFEK3okK4te2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042