UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E51Rj2HO/+KI8GhKepqa51hgG+4hy7zIDbl0K6mdlCs=' 
WHERE 
  key_id = '3679de757fe80cf98132317eb591594e53417321aa7475c24a54bf8636b77eec' 
  AND (
    token = 'E51Rj2HO/+KI8GhKepqa51hgG+4hy7zIDbl0K6mdlCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039