UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WJFiuXOBINmctf1G9H+UQcsO41hVT2bwD3gW+wooyBQ=' 
WHERE 
  key_id = '7103b731d97f754bf27a42f407a44c39016ac501e7af14280a281fb20753772e' 
  AND (
    token = 'WJFiuXOBINmctf1G9H+UQcsO41hVT2bwD3gW+wooyBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034