UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'npYlH1LqZxS5mk6JWfGflvvnxZYvbDvQQ+K6c8IfHwc=' 
WHERE 
  key_id = '8baa66e3444f99aa871dc678f1e07d930ae2e1cebf93e16d5e5ac470a0bd8878' 
  AND (
    token = 'npYlH1LqZxS5mk6JWfGflvvnxZYvbDvQQ+K6c8IfHwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039