UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QpYbiaDphDcOfyfpfMQn8x8b9IHqM8ma03RvMmNjOug=' 
WHERE 
  key_id = '02b72daf24cfb2860370ea9eca593bba41f6721909056510ef805ca8ccc19a81' 
  AND (
    token = 'QpYbiaDphDcOfyfpfMQn8x8b9IHqM8ma03RvMmNjOug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034