UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XMHO8XVLV4VUX1OhbhdurMFOY3GnpKOFotQ6xk+xT/c=' 
WHERE 
  key_id = '6f38953901bc28f31e6bba720c1e2668ea35dbbbd69e4c4d142cbf35ed92d1b8' 
  AND (
    token = 'XMHO8XVLV4VUX1OhbhdurMFOY3GnpKOFotQ6xk+xT/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047