UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2WmBv8RzO81qQRqpmv+UhGTso22SfHFpyuioukesqMw=' 
WHERE 
  key_id = '40311808effcf03e303f008fc36d3b6ed6689f897e8469e106d9711bc326ae94' 
  AND (
    token = '2WmBv8RzO81qQRqpmv+UhGTso22SfHFpyuioukesqMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050