UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VIaEl/Le7Ry5kSeCLtq6Ddcvi3y+bx26bDEfpz81ROc=' 
WHERE 
  key_id = 'c87f7d8b3a438a3809c408651e6fe1b8f0c9902c03c67994dab6ec7914eda083' 
  AND (
    token = 'VIaEl/Le7Ry5kSeCLtq6Ddcvi3y+bx26bDEfpz81ROc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026