UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LiqkpdGmm+20eBjjz847Vf3p0yco+uvsib/jZaToXCU=' 
WHERE 
  key_id = 'e7353df0a492bac3b0b9aae7be5929ff3536da53f6f32171fc9c41ea0a20f599' 
  AND (
    token = 'LiqkpdGmm+20eBjjz847Vf3p0yco+uvsib/jZaToXCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044