UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'atSr0Q2rNgYw+aBRPdfiiHpNP6vVH4pcOjfyXKEMLLI=' 
WHERE 
  key_id = 'dba4c45f97b812ba3a37571a0741664a3624d0af66787843cb4dca35bf5af8d6' 
  AND (
    token = 'atSr0Q2rNgYw+aBRPdfiiHpNP6vVH4pcOjfyXKEMLLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038