UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mh/Gd2tatVbPH4bSmYj2W9rhe4ypb7GKpGBtIB/4LNc=' 
WHERE 
  key_id = 'ddb477956316d5f0259767bb7f18d7f749438d456e81fb0b6ae1c79cde10789a' 
  AND (
    token = 'Mh/Gd2tatVbPH4bSmYj2W9rhe4ypb7GKpGBtIB/4LNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030