UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THD4rngGSehSnQdXQGh087byhWuuJpYR5KA+flEXpzg=' 
WHERE 
  key_id = 'b78e557637721ec10204b366b96da34c569477076ddb4b490b986d31b6ecf753' 
  AND (
    token = 'THD4rngGSehSnQdXQGh087byhWuuJpYR5KA+flEXpzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024