UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j7KTvnhJTWjnUzLcmoi+jF8U+717K7Bcy/ITBw2Ibk4=' 
WHERE 
  key_id = '2e1daa35f3841b36ec6eac88f225e6af26b3e93da9765ec26ee4c788b3c93398' 
  AND (
    token = 'j7KTvnhJTWjnUzLcmoi+jF8U+717K7Bcy/ITBw2Ibk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024