UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pN+PcBoPzN+eBlkv8NfuZvPM65yrcZahTK1qgSMh8P4=' 
WHERE 
  key_id = '6a81bb723ee156fa06189330a791b70f73b080f40735498a43ce630517fedaf5' 
  AND (
    token = 'pN+PcBoPzN+eBlkv8NfuZvPM65yrcZahTK1qgSMh8P4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030