UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MBp2rHL37I4PaP1Ac9ye+STI3z4FuVmW81Ye2xqcpKQ=' 
WHERE 
  key_id = '7e187ed8061bbfdf83c70e3a6410ff90b5743800a5d99376797d22b2077a9fcc' 
  AND (
    token = 'MBp2rHL37I4PaP1Ac9ye+STI3z4FuVmW81Ye2xqcpKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017