UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C/znUKCbrvur73IAyZ89/mWHC67Vs4+tHo5//jiSf84=' 
WHERE 
  key_id = '022f732e1a972c0232b8dc6fb5bc938aa13ac64ea55e6611971d365f9e07846e' 
  AND (
    token = 'C/znUKCbrvur73IAyZ89/mWHC67Vs4+tHo5//jiSf84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031