UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K89pyVV1vRSA/niruuBT+yIolGF800EMOQTdNlvI7J4=' 
WHERE 
  key_id = 'f9a65db6203448757724aad4df1b1d03b6964b4c5ad21ab6ba1895725e7b2946' 
  AND (
    token = 'K89pyVV1vRSA/niruuBT+yIolGF800EMOQTdNlvI7J4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050