UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBtWntukom/P4qUn3ywsiQMlVydLf6fFE44EHQVoSmw=' 
WHERE 
  key_id = '254f63b3ccea7110454e9220b19edcde5851d2c506f7dd6d4226d442226f880f' 
  AND (
    token = 'fBtWntukom/P4qUn3ywsiQMlVydLf6fFE44EHQVoSmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018