UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nmqfYMeiQA1fuhzPyCOJmmNUWEBhclwhF3OZmFuZS3w=' 
WHERE 
  key_id = '2e1a65f9dfea5058b5727b30419a0b4c63f4219fd4f79c87a3250fed1207fc88' 
  AND (
    token = 'nmqfYMeiQA1fuhzPyCOJmmNUWEBhclwhF3OZmFuZS3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032