UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wt3iOLjI4L8EwbcYXxuS3N1CVwbQ7PhI2k6sD6rtLQ8=' 
WHERE 
  key_id = '04e5bd56b5b9ae9b079647059639b2f3cc9a0efe7b8e580c5b11b307ff515418' 
  AND (
    token = 'Wt3iOLjI4L8EwbcYXxuS3N1CVwbQ7PhI2k6sD6rtLQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046