UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mm4i0xdFQjSosKEXtJJp3xgD9uKgZK6xK7+Z8gF3nao=' 
WHERE 
  key_id = 'f26d4aa387ee9f1af6045ef2ff8b7828e1500c3415915560d1835b67de937457' 
  AND (
    token = 'Mm4i0xdFQjSosKEXtJJp3xgD9uKgZK6xK7+Z8gF3nao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020