UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bCWcu7RO7e8XVJHM+icaHmdHdPdntNHc8h7sDO5qnMQ=' 
WHERE 
  key_id = '655d0e6eb029dbdf27884bad2c79760822885e069e8037fa5bfa8fc9cb1ff7a8' 
  AND (
    token = 'bCWcu7RO7e8XVJHM+icaHmdHdPdntNHc8h7sDO5qnMQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037