UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y+GzlM96fMSS7XWj/oVLWyDYgJpcoFDsDA7ssuvOb7M=' 
WHERE 
  key_id = 'ac1c65d520a890c7bc88e6d04add052564215d4295fc36c4804796e9fabaaaa6' 
  AND (
    token = 'y+GzlM96fMSS7XWj/oVLWyDYgJpcoFDsDA7ssuvOb7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041