UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4g8VJu7OwDNDoNsRIaLipizlBrfZYKIknE5dAET4fvM=' 
WHERE 
  key_id = '0bca854362fabc3740f49383fe7595d51d9c05276e97eda81c1cf100e1265f18' 
  AND (
    token = '4g8VJu7OwDNDoNsRIaLipizlBrfZYKIknE5dAET4fvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038