UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gliqKnwh2dyXISM92znOA5VbYjFhKK3w/pSt+Fg+mes=' 
WHERE 
  key_id = '94e1a8f89809560c3e9106889697125cde419e88344cd5814bd52e397347dce2' 
  AND (
    token = 'gliqKnwh2dyXISM92znOA5VbYjFhKK3w/pSt+Fg+mes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031