UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w5+M07JR3XBW/5WhZ1pd7e2hbiv5stMKXC0/RAFnBI4=' 
WHERE 
  key_id = '4ebaf116fa58acb985c5e06641d87e4fb8fb383e186a6e9290dfebf5301a229e' 
  AND (
    token = 'w5+M07JR3XBW/5WhZ1pd7e2hbiv5stMKXC0/RAFnBI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017