UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XAwJGZg9w6+WEdGNvckgFQiU9gY4dWRkKvCel/dWc+I=' 
WHERE 
  key_id = 'e9cfd6dcb02f80d3ba60be571f21b1c67e15c6cce1ab7824c2b08be44e468b72' 
  AND (
    token = 'XAwJGZg9w6+WEdGNvckgFQiU9gY4dWRkKvCel/dWc+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038