UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1i2F9pP5VHxhOCrlOeXdwmAWpLl8kzWcGYkTb1RZ8r0=' 
WHERE 
  key_id = 'b5378c99e7148ea5717a317e46c13abd211622efeed6386eb9d57c3de0cd2207' 
  AND (
    token = '1i2F9pP5VHxhOCrlOeXdwmAWpLl8kzWcGYkTb1RZ8r0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023