UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bSzUQSVaJp2Fm8qyXDLKus23z4AM1kIeRz1WtkAo/wo=' 
WHERE 
  key_id = '4489d71db389ea0627f8ea8cfc0a07ec9c296ef27c5e06b2e3a87ae7a2eb8712' 
  AND (
    token = 'bSzUQSVaJp2Fm8qyXDLKus23z4AM1kIeRz1WtkAo/wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068